<?php
mysql_select_db($database_konek, $konek);
$query_past = "SELECT * FROM bannerplug WHERE id = $pilih_sett";
$past = mysql_query($query_past, $konek) or die(mysql_error());
$row_past = mysql_fetch_assoc($past);
$totalRows_past = mysql_num_rows($past);
?>
<?php
mysql_select_db($database_konek, $konek);
$query_past2 = "SELECT * FROM bannerplug_data WHERE id_module = '$row_past[id]'";
$past2 = mysql_query($query_past2, $konek) or die(mysql_error());
$row_past2 = mysql_fetch_assoc($past2);
$totalRows_past2 = mysql_num_rows($past2);
if ($totalRows_past2>0){
?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
  <?php for($s=1;$s<=$totalRows_past2;$s++) { ?>
    <li data-target="#carousel-example-generic" data-slide-to="<?php echo $i++-1 ?>"></li>
   <?php } ?>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner">
  <?php $num=0; do { ?>
    <div class="item<?php if ($num++==0)  echo " active";  ?>">
      <img src="<?php echo $base_url ?>/g-konten/fm/slide/<?php echo $row_past['id']; ?>/<?php echo $row_past2['image']; ?>" alt="<?php echo $num++ ?>">
      <div class="carousel-caption">
        <h2><?php echo $row_past2['nama']; ?></h2>
        <?php echo $row_past2['deskripsi']; ?>
      </div>
    </div>
    <?php } while ($row_past2 = mysql_fetch_assoc($past2)); ?>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left"></span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right"></span>
  </a>
</div>
<?php
}
mysql_free_result($past2);
mysql_free_result($past);
?>